#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2022/1/20 23:17
# @Author  : FLC
# @File    : we_work.py
# @Software: PyCharm

from interface.api_object.apis.base_api import BaseApi
from interface.api_object.utils.log_tool import logger


class WeWork(BaseApi):

    base_url = "https://qyapi.weixin.qq.com/cgi-bin"

    def get_access_token(self, corp_id, corp_secret):
        logger.info("开始获取token")
        param = {
            "corpid": corp_id,
            "corpsecret": corp_secret,
        }

        url = "/gettoken"
        method = "GET"

        res = self.send(method=method, url=url, params=param)
        return res.json().get("access_token")

